﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UIShare;
using EFong.View.Proxy;

namespace EFong.View.Report
{
    public partial class Frm_资金流动报表 : BasicForm
    {
        private Proxy.ReportServiceProxy _reportProxy {get{ return Proxy.ReportServiceProxy.GetInstance();}}

        public Frm_资金流动报表()
        {
            InitializeComponent();
        }

        protected override void InitFields()
        {
        }

        private void bar_Main_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (e.Item.Name)
            {
                case "bbt_Export":
                    this.export();
                    break;
                case "bbt_Close":
                    this.Close();
                    break;
                default:
                    break;
            }
        }

        protected override void Events()
        {
            this.Load += (s, e) =>
            {
                Contract.资金流动报表 资金流动报表 = _reportProxy.GetReport15().ReturnValue;

                this.txt_AccountReceiveLosse.Text = 资金流动报表.散客应收总帐.ToString();
                this.txt_AccountReceiveMonth.Text = 资金流动报表.月结应收总帐.ToString();
                this.txt_NewAccouReceiveLosse.Text = 资金流动报表.今日散客应收总帐.ToString();
                this.txt_NewAccountReceiveMonth.Text = 资金流动报表.今日月结应收总帐.ToString();
                this.txt_TotalAmount.Text = 资金流动报表.总资金.ToString();
                this.txt_TotalCash.Text = 资金流动报表.总现金.ToString();
                this.txt_AccountPayment.Text = 资金流动报表.今日总付帐.ToString();
                this.txt_TotalPrepay.Text = 资金流动报表.预存总款.ToString();
                this.txt_CashIn.Text = 资金流动报表.今日现金收入.ToString();
                this.txt_CashOut.Text = 资金流动报表.今日现金支出.ToString();
                this.txt今日利润.Text = 资金流动报表.今日利润.ToString();
                this.txt预期利润.Text = 资金流动报表.预期利润.ToString();

                this.grd_BankAccount.DataSource = 资金流动报表.明细;
            };
        }

        protected override void LoadDatas()
        {
            this.lbl_Caption.Text = string.Format("{0} 资金流动情况：", Proxy.BaseServiceProxy.GetInstance().GetDate().ReturnValue.ToString("yyyy/MM/dd"));
        }

        private void export()
        {
            FileExport.ExportToExcel(this.grd_BankAccount, "资金流动报表");
        }

    }
}
